home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Languguage OS 2
/
Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO
/
a_utils
/
perl
/
prlbkxmp.lha
/
ch2
/
reproach
< prev
next >
Wrap
Text File
|
1991-01-07
|
496b
|
28 lines
#!/usr/bin/perl
$_ = <STDIN>;
if (!/camels (\d+)/) {
print STDERR "Incorrect format--please try again!\n";
$errors++;
}
if ($1 <= 0) {
print STDERR "Incorrect format--please try again!\n";
$errors++;
}
if (/pigs/) {
print STDERR "Incorrect format--please try again!\n";
$errors++;
}
# Alternate approach
&reproach if !/camels (\d+)/;
&reproach if $1 <= 0;
&reproach if /pigs/;
sub reproach {
print STDERR "Incorrect format--please try again!\n";
$errors++;
}